Bug #4855
This bug was patched, submitted, and approved by the Yorba Development Team. This bug was an aesthetic change to the text of the Edit menu. The text was changed to read "New Saved Search...".
This bug related to the separation between the main photo window and the search toolbar. Due to color similarities, it was difficult to tell where the toolbar ended and the photo window began. The spacing between the two has been increased so that the boundary between the two is more clear. A patch has been added to the bug, but there has not been an update from the Shotwell team as of yet.
The bug we have decided to fix is one related to searching for photos. Currently if you search for photos between a date range the beginning and ending dates will be excluded. The search needs to be inclusive.
Here is a description of the bug:
If you have a saved search with a between date condition, then the begin and end dates are not included into the result.
For example you have photos from the following dates:
01.01.2011, 02.01.2011, 03.01.2011
And your search criteria is between 01.01.2011 and 03.01.2011, then the result will only display photos from the 02.01.2011.
I would expect the photos from all three days.
// Determines whether the source is included.
public override bool predicate(MediaSource source) {
time_t exposure_time = source.get_exposure_time();
if (exposure_time == 0)
return context == Context.IS_NOT_SET;
DateTime dt = new DateTime.from_unix_local(exposure_time);
switch (context) {
case Context.EXACT:
DateTime second = date_one.add_days(1);
return (dt.compare(date_one) >= 0 && dt.compare(second) < 0);
case Context.AFTER:
return (dt.compare(date_one) >= 0);
case Context.BEFORE:
return (dt.compare(date_one) <= 0);
case Context.BETWEEN:
return (dt.compare(date_one) >= 0 && dt.compare(date_two) < 0);
case Context.IS_NOT_SET:
return false; // Already checked above.
default:
error("unrecognized date search context enumeration value");
}
}
}
The case for Context.BETWEEN is where the problem lies. We plan on looking into the Vala DateTime functions and seeing if the problem lies there or with in the case statement itself.
What We Did
Our initial idea that the problem could be found in the Context.BETWEEN section turned out to be correct. In fact, the fix turned out to be fairly straightforward. It turned out that the issue was in the second half of the conditional in the return statement of the Context.BETWEEN case. When a user selects an end date for the search, the date was being set to the very beginning of the day i.e., 12:00:00 am.
If a user wanted to search from February 7 to February 8, only the very first second of the 8th would fall within the bounds of the conditional. The fix was to add a day to the second date in the search. At first glance, this could create another bug, where a picture taken at 12:00:00 am on the day just past the selected time frame would show up in the search. This would only be the case if the conditional where a less-than-or-equal-to.
The code as it stands now.
// Determines whether the source is included.
public override bool predicate(MediaSource source) {
time_t exposure_time = source.get_exposure_time();
if (exposure_time == 0)
return context == Context.IS_NOT_SET;
DateTime dt = new DateTime.from_unix_local(exposure_time);
switch (context) {
case Context.EXACT:
DateTime second = date_one.add_days(1);
return (dt.compare(date_one) >= 0 && dt.compare(second) < 0);
case Context.AFTER:
return (dt.compare(date_one) >= 0);
case Context.BEFORE:
return (dt.compare(date_one) <= 0);
case Context.BETWEEN:
DateTime second = date_two.add_days(1);
return (dt.compare(date_one) >= 0 && dt.compare(second) < 0);
case Context.IS_NOT_SET:
return false; // Already checked above.
default:
error("unrecognized date search context enumeration value");
}
}
http://redmine.yorba.org/projects/shotwell/issues
Bug #4855
This bug was patched, submitted, and approved by the Yorba Development Team. This bug was an aesthetic change to the text of the Edit menu. The text was changed to read "New Saved Search...".
Bug #3274
This bug related to the separation between the main photo window and the search toolbar. Due to color similarities, it was difficult to tell where the toolbar ended and the photo window began. The spacing between the two has been increased so that the boundary between the two is more clear. A patch has been added to the bug, but there has not been an update from the Shotwell team as of yet.
Bug #4542
The bug we have decided to fix is one related to searching for photos. Currently if you search for photos between a date range the beginning and ending dates will be excluded. The search needs to be inclusive.
Here is a description of the bug:
If you have a saved search with a between date condition, then the begin and end dates are not included into the result.
For example you have photos from the following dates:
01.01.2011, 02.01.2011, 03.01.2011
And your search criteria is between 01.01.2011 and 03.01.2011, then the result will only display photos from the 02.01.2011.
I would expect the photos from all three days.
Full bug information can be found here:
http://redmine.yorba.org/issues/4542
Here is the code that needs to be fixed:
// Determines whether the source is included. public override bool predicate(MediaSource source) { time_t exposure_time = source.get_exposure_time(); if (exposure_time == 0) return context == Context.IS_NOT_SET; DateTime dt = new DateTime.from_unix_local(exposure_time); switch (context) { case Context.EXACT: DateTime second = date_one.add_days(1); return (dt.compare(date_one) >= 0 && dt.compare(second) < 0); case Context.AFTER: return (dt.compare(date_one) >= 0); case Context.BEFORE: return (dt.compare(date_one) <= 0); case Context.BETWEEN: return (dt.compare(date_one) >= 0 && dt.compare(date_two) < 0); case Context.IS_NOT_SET: return false; // Already checked above. default: error("unrecognized date search context enumeration value"); } } }The case for Context.BETWEEN is where the problem lies. We plan on looking into the Vala DateTime functions and seeing if the problem lies there or with in the case statement itself.What We Did
Our initial idea that the problem could be found in the Context.BETWEEN section turned out to be correct. In fact, the fix turned out to be fairly straightforward. It turned out that the issue was in the second half of the conditional in the return statement of the Context.BETWEEN case. When a user selects an end date for the search, the date was being set to the very beginning of the day i.e., 12:00:00 am.
If a user wanted to search from February 7 to February 8, only the very first second of the 8th would fall within the bounds of the conditional. The fix was to add a day to the second date in the search. At first glance, this could create another bug, where a picture taken at 12:00:00 am on the day just past the selected time frame would show up in the search. This would only be the case if the conditional where a less-than-or-equal-to.
The code as it stands now.
// Determines whether the source is included. public override bool predicate(MediaSource source) { time_t exposure_time = source.get_exposure_time(); if (exposure_time == 0) return context == Context.IS_NOT_SET; DateTime dt = new DateTime.from_unix_local(exposure_time); switch (context) { case Context.EXACT: DateTime second = date_one.add_days(1); return (dt.compare(date_one) >= 0 && dt.compare(second) < 0); case Context.AFTER: return (dt.compare(date_one) >= 0); case Context.BEFORE: return (dt.compare(date_one) <= 0); case Context.BETWEEN: DateTime second = date_two.add_days(1); return (dt.compare(date_one) >= 0 && dt.compare(second) < 0); case Context.IS_NOT_SET: return false; // Already checked above. default: error("unrecognized date search context enumeration value"); } }